# 猜拳小游戏改进版，若用户赢了三次，则退出游戏
count=0
import random
while True:
    if count>=3:
        print("您已经连续赢了3次")
        break
    computer = random.randint(0, 2)  # 使用randint方法，随机产生数字，括号内可以指定数字范围
    print(computer)
    user = int(input("请出拳 ：【0：石头   1：剪刀     2：布】"))
    if user == 0 and computer == 1:
        count+=1
        print("真厉害，您赢了！")
    elif user == 0 and computer == 2:
        print("很遗憾，您输了！")
    elif user == 0 and computer == 0:
        print("平局！")
    elif user == 1 and computer == 0:
        print("很遗憾，您输了！")
    elif user == 1 and computer == 2:
        count += 1
        print("真厉害，您赢了！")
    elif user == 1 and computer == 1:
        print("平局！")
    elif user == 2 and computer == 0:
        count += 1
        print("真厉害，您赢了！")
    elif user == 2 and computer == 1:
        print("很遗憾，您输了！")
    elif user == 2 and computer == 2:
        print("平局！")
    else:
        print("您输入有误")